﻿@{
    Layout = null;
    var list = ViewBag.listMy as List<FileInfoMy>;
}
@using WebApplicationFileSys.Models
@if (list != null && list.Count != 0)
{
    foreach (var item in list)
    {

        string extend = Path.GetExtension(item.FileName).ToLower();
        bool imgIs = !string.IsNullOrWhiteSpace(extend) && ".jpg*.jpeg*.png*.jfif*.gif*.bmp*.webp*.ico".Contains(extend);
        <tr>
            <td>
                <span class="itemCell">@item.CreateTime.ToString("yyyy-MM-dd HH:mm:ss")</span>
            </td>
            @if (string.IsNullOrEmpty(item.FileSize))
            {
                <td>   <span class="itemCell"><a href="/home/SeeDir?dirNew=@item.FileNamePath" style="color: #1e9fff;"><i class="layui-icon layui-icon-export"></i>@item.FileName</a></span></td>
                <td>  <span class="itemCell"><a href="/home/SeeDir?dirNew=@item.FileNamePath">@item.FileName</a></span></td>

            }
            else
            {
                <td>
                    <span>@item.FileSize</span>
                </td>
                <td>
                    <span class="itemCell" style="font-weight:bold;font-size:16px;">
                        @if (imgIs)
                        {

                            <a href="/home/SeeImg?file=@item.FileNamePath" target="_blank">
                                <img src="/home/SeeImg?file=@item.FileNamePath" data-src="/home/SeeImg?file=@item.FileNamePath" style="height:30px;" />
                            </a>

                        }
                    <a href="/home/SeeFile?file=@item.FileNamePath" target="_blank"> @item.FileName <i class="layui-icon layui-icon-download-circle"></i> </a>
                    </span>
                </td>
            }
            @if (LoginMode.admin)
            {
                <td>

                    <i class="layui-icon layui-icon-delete" onclick="delFile('@item.FileNamePath','@ViewBag.dirNew')"></i>

                </td>
            }
        </tr>
    }
}